// Author: combacsa@kaist.ac.kr
// http://www.jungol.co.kr/prog/Hanal/hanalView.php?qs_code=128

//#define COMPILE
#ifdef COMPILE

#include <fstream>
using namespace std;

int main() {
	ifstream in("input.txt");
	int n;
	int x;
	n = 0;
	in >> x;
	while (x != 0) {
		if ((x % 3 != 0) && (x % 5 != 0))
			n++;
		in >> x;
	}
	in.close();
	ofstream out("output.txt");
	out << n << endl;
	out.close();

	return 0;
}
#endif
